package com.junci.mtest.model.bean;

import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

import com.google.gson.Gson;
import com.junci.mtest.utils.SharePrefUtil;


/**
 * 自己的状态数据
 */
public class MySelfInfo implements Parcelable {
    private static final String TAG = MySelfInfo.class.getSimpleName();
    private String id = "0";
    private String user_name = "" ;

    public String getNick_name() {
        return nick_name;
    }

    public void setNick_name(String nick_name) {
        this.nick_name = nick_name;
    }


    private String nick_name = "" ;
    private String moblie = "" ;
    private String show_id = "" ;
    private String prant_id = "" ;
    private String qr_url = "" ;
    private double coin = 0f ;
    private String target_step = "0" ;
    private String my_code = "" ;
    private String my_token = "" ;
    private String _idcard_num = "" ;
    private String _idcard_name = "" ;
    private String id_card_below = "" ;
    private String id_card_above = "" ;
    private String id_password = "" ;
    private String password = "" ;

    public String getId_password() {
        return id_password;
    }

    public void setId_password(String id_password) {
        this.id_password = id_password;
    }

    private int isDouble = 0 ;
    private int user_status = 0 ;
    private int msg_total = 0 ;
    private int is_real_name = 0 ;
    private int is_first_draw = 0 ;
    private int is_tl = 0 ;
    private int newsertime = 0;
    private int boss_type = 0 ;
    private long vip_time = 1 ;
    private int produce_per = 0 ;
    private double integral_all = 0 ;
    private double integral_used = 0 ;
    private double active_num = 0 ;
    private double footmark = 0 ;
    private double contribute = 0 ;

    public int getNewsertime() {
        return newsertime;
    }

    public void setNewsertime(int newsertime) {
        this.newsertime = newsertime;
    }

    public long getVip_time() {
        return vip_time;
    }

    public void setVip_time(long vip_time) {
        this.vip_time = vip_time;
    }

    public int getIs_tl() {
        return is_tl;
    }

    public void setIs_tl(int is_tl) {
        this.is_tl = is_tl;
    }

    public int getBoss_type() {
        return boss_type;
    }

    public void setBoss_type(int boss_type) {
        this.boss_type = boss_type;
    }

    public double getContribute() {
        return contribute;
    }

    public int getProduce_per() {
        return produce_per;
    }

    public void setProduce_per(int produce_per) {
        this.produce_per = produce_per;
    }

    public void setContribute(double contribute) {
        this.contribute = contribute;
    }

    public double getFootmark() {
        return footmark;
    }

    public void setFootmark(double footmark) {
        this.footmark = footmark;
    }

    public double getActive_num() {
        return active_num;
    }

    public void setActive_num(double active_num) {
        this.active_num = active_num;
    }

    private int pay_type = 0 ;

    public int getPay_type() {
        return pay_type;
    }

    public void setPay_type(int pay_type) {
        this.pay_type = pay_type;
    }

    public int getMsg_total() {
        return msg_total;
    }

    public void setMsg_total(int msg_total) {
        this.msg_total = msg_total;
    }

    public String getMoblie() {
        return moblie;
    }

    public String get_idcard_num() {
        return _idcard_num;
    }

    public void set_idcard_num(String _idcard_num) {
        this._idcard_num = _idcard_num;
    }

    public String get_idcard_name() {
        return _idcard_name;
    }

    public void set_idcard_name(String _idcard_name) {
        this._idcard_name = _idcard_name;
    }

    public String getId_card_below() {
        return id_card_below;
    }

    public void setId_card_below(String id_card_below) {
        this.id_card_below = id_card_below;
    }

    public String getId_card_above() {
        return id_card_above;
    }

    public void setId_card_above(String id_card_above) {
        this.id_card_above = id_card_above;
    }

    public void setMoblie(String moblie) {
        this.moblie = moblie;
    }

    public String getMy_token() {
        return my_token;
    }

    public void setMy_token(String my_token) {
        this.my_token = my_token;
    }

    public double getIntegral_all() {
        return integral_all;
    }

    public void setIntegral_all(double integral_all) {
        this.integral_all = integral_all;
    }

    public double getIntegral_used() {
        return integral_used;
    }

    public void setIntegral_used(double integral_used) {
        this.integral_used = integral_used;
    }

    public int getIs_real_name() {
        return is_real_name;
    }

    public void setIs_real_name(int is_real_name) {
        this.is_real_name = is_real_name;
    }

    public int getIs_first_draw() {
        return is_first_draw;
    }

    public void setIs_first_draw(int is_first_draw) {
        this.is_first_draw = is_first_draw;
    }


    public int getUser_status() {
        return user_status;
    }

    public void setUser_status(int user_status) {
        this.user_status = user_status;
    }

    public int getIsDouble() {
        return isDouble;
    }

    public void setIsDouble(int isDouble) {
        this.isDouble = isDouble;
    }

    public String getTarget_step() {
        return target_step;
    }

    public void setTarget_step(String target_step) {
        this.target_step = target_step;
    }

    public double getCoin() {
        return coin;
    }

    public void setCoin(double coin) {
        this.coin = coin;
    }

    public String getMy_code() {
        return my_code;
    }

    public void setMy_code(String my_code) {
        this.my_code = my_code;
    }

    public String getPrant_id() {
        return prant_id;
    }

    public void setPrant_id(String prant_id) {
        this.prant_id = prant_id;
    }

    private String avater = "" ;
    private int video = 0 ;

    public int getCheck_reward() {
        return check_reward;
    }

    public void setCheck_reward(int check_reward) {
        this.check_reward = check_reward;
    }

    private int check_reward = 0 ;

    public int getVideo() {
        return video;
    }

    public void setVideo(int video) {
        this.video = video;
    }

    public String getAvater() {
        return avater;
    }

    public void setAvater(String avater) {
        this.avater = avater;
    }

    public String getQr_url() {
        return qr_url;
    }

    public void setQr_url(String qr_url) {
        this.qr_url = qr_url;
    }

    public String getUser_name() {
        return user_name;
    }

    public void setUser_name(String user_name) {
        this.user_name = user_name;
    }

    public String getShow_id() {
        return show_id;
    }

    public void setShow_id(String show_id) {
        this.show_id = show_id;
    }

    private static MySelfInfo ourInstance = new MySelfInfo();
    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.id);
        dest.writeString(this.user_name);
        dest.writeString(this.show_id);
        dest.writeString(this.my_code);
        dest.writeString(this.qr_url);
        dest.writeString(this.password);
        dest.writeString(this.avater);
        dest.writeDouble(this.coin);
        dest.writeInt(this.video);
        dest.writeInt(this.is_tl);
        dest.writeInt(this.boss_type);
        dest.writeInt(this.check_reward);
        dest.writeInt(this.produce_per);
        dest.writeLong(this.vip_time);
        dest.writeInt(this.isDouble);
        dest.writeInt(this.user_status);
        dest.writeInt(this.is_real_name);
        dest.writeInt(this.pay_type);
        dest.writeInt(this.is_first_draw);
        dest.writeDouble(this.integral_all);
        dest.writeDouble(this.contribute);
        dest.writeDouble(this.integral_used);
        dest.writeDouble(this.active_num);
        dest.writeDouble(this.footmark);
        dest.writeInt(this.msg_total);
        dest.writeString(this.target_step);
        dest.writeString(this.prant_id);
        dest.writeString(this.my_token);
        dest.writeString(this.nick_name);
        dest.writeString(this.moblie);
        dest.writeString(this._idcard_num);
        dest.writeString(this._idcard_name);
        dest.writeString(this.id_card_below);
        dest.writeString(this.id_card_above);
        dest.writeString(this.id_password);
        dest.writeInt(this.newsertime);

    }
    public MySelfInfo() {
    }

    protected MySelfInfo(Parcel in) {
        this.id = in.readString();
        this.user_name = in.readString();
        this.show_id = in.readString();
        this.password = in.readString();
        this.qr_url = in.readString();
        this.vip_time = in.readLong();
        this.avater = in.readString();
        this.my_code = in.readString();
        this.coin = in.readDouble();
        this.video = in.readInt();
        this.newsertime = in.readInt();
        this.is_tl = in.readInt();
        this.boss_type = in.readInt();
        this.produce_per = in.readInt();
        this.check_reward = in.readInt();
        this.isDouble = in.readInt();
        this.user_status = in.readInt();
        this.is_real_name = in.readInt();
        this.is_first_draw = in.readInt();
        this.pay_type = in.readInt();
        this.integral_all = in.readDouble();
        this.integral_used = in.readDouble();
        this.contribute = in.readDouble();
        this.footmark = in.readDouble();
        this.active_num = in.readDouble();
        this.target_step = in.readString();
        this.prant_id = in.readString();
        this.my_token = in.readString();
        this.nick_name = in.readString();
        this.moblie = in.readString();
        this._idcard_num = in.readString();
        this._idcard_name = in.readString();
        this.id_card_below = in.readString();
        this.id_card_above = in.readString();
        this.id_password = in.readString();
        this.msg_total = in.readInt();

    }
    public static MySelfInfo getInstance() {
        return ourInstance;
    }

    public String getId() {
//        this.getCache(MyApplication.application);
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void clearCache(Context context) {
        SharePrefUtil.saveString(context, SharePrefUtil.SP_USER_INFO_SAVE_KEY, "");
        this.setId("");
    }
    public void saveCache(Context context) {
        Gson gson = new Gson();
        String js = gson.toJson(this);
        SharePrefUtil.saveString(context, SharePrefUtil.SP_USER_INFO_SAVE_KEY, js);
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public boolean getCache(Context context) {
        String string = SharePrefUtil.getString(context, SharePrefUtil.SP_USER_INFO_SAVE_KEY, "");
        if (!TextUtils.isEmpty(string)) {
            // 有数据
            Gson gson = new Gson();
            try {
                MySelfInfo mySelfInfo = gson.fromJson(string, this.getClass());
                this.setId(mySelfInfo.getId());
                this.setNewsertime(mySelfInfo.getNewsertime());
                this.setUser_name(mySelfInfo.getUser_name());
                this.setProduce_per(mySelfInfo.getProduce_per());
                this.setContribute(mySelfInfo.getContribute());
                this.setVip_time(mySelfInfo.getVip_time());
                this.setShow_id(mySelfInfo.getShow_id());
                this.setQr_url(mySelfInfo.getQr_url());
                this.setAvater(mySelfInfo.getAvater());
                this.setVideo(mySelfInfo.getVideo());
                this.setIntegral_all(mySelfInfo.getIntegral_all());
                this.setFootmark(mySelfInfo.getFootmark());
                this.setActive_num(mySelfInfo.getActive_num());
                this.setIntegral_used(mySelfInfo.getIntegral_used());
                this.setCheck_reward(mySelfInfo.getCheck_reward());
                this.setCoin(mySelfInfo.getCoin());
                this.setTarget_step(mySelfInfo.getTarget_step());
                this.setIsDouble(mySelfInfo.getIsDouble());
                this.setIs_first_draw(mySelfInfo.getIs_first_draw());
                this.setIs_real_name(mySelfInfo.getIs_real_name());
                this.setUser_status(mySelfInfo.getUser_status());
                this.setMy_code(mySelfInfo.getMy_code());
                this.setPrant_id(mySelfInfo.getPrant_id());
                this.setMy_token(mySelfInfo.getMy_token());
                this.setNick_name(mySelfInfo.getNick_name());
                this.setMoblie(mySelfInfo.getMoblie());
                this.set_idcard_name(mySelfInfo.get_idcard_name());
                this.set_idcard_num(mySelfInfo.get_idcard_num());
                this.setId_card_above(mySelfInfo.getId_card_above());
                this.setId_card_below(mySelfInfo.getId_card_below());
                this.setMsg_total(mySelfInfo.getMsg_total());
                this.setId_password(mySelfInfo.getId_password());
                this.setPay_type(mySelfInfo.getPay_type());
                this.setBoss_type(mySelfInfo.getBoss_type());
                this.setIs_tl(mySelfInfo.getIs_tl());
                this.setPassword(mySelfInfo.getPassword());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return true;
        }
        return false;
}


    @Override
    public int describeContents() {
        return 0;
    }


    public static final Creator<MySelfInfo> CREATOR = new Creator<MySelfInfo>() {
        @Override
        public MySelfInfo createFromParcel(Parcel source) {
            return new MySelfInfo(source);
        }

        @Override
        public MySelfInfo[] newArray(int size) {
            return new MySelfInfo[size];
        }
    };
}